
import { AudioClip, AudioSourceComponent, _decorator } from "cc";
import { Global } from "./Global";

const { ccclass, property } = _decorator;

@ccclass("AudioMgr")
export class AudioMgr {
    private _audioComp: AudioSourceComponent = null;

    private static _ins: AudioMgr = null!;

    public static get ins() {
        if (!this._ins) {
            this._ins = new AudioMgr();
            this._ins.initAudio();
        }
        return this._ins;
    }

    private initAudio() {
        this._audioComp = new AudioSourceComponent();
        this._audioComp.loop = true;
    }
    public async playSound(audio: string, scale = 0.8) {
       if(!Global.sound_switch){
         return;
       }
        // let clip = await ResMgr.ins.getClip(audio);
        // this._audioComp.playOneShot(clip, scale);
    }
}